<?php

/**
 *
 *	@author Smarttang <[<yucong.tang@zhaopin.com.cn>]>
 *	@date(2017.8.10) 创建
 * 
 */
class Charts_model extends CI_Model{

	function __construct()
	{
		$this->load->helper('date');
		$this->load->database();
	}

	function allcharts($datastatus)
	{
		if ($datastatus == 'static'){
			return array(
				'status' => 1,
				'legenddata' => array('WAF触发量','风控触发量'),
				'timedata' => array('2017-08-10 12:19:13','2017-08-10 12:19:14','2017-08-10 12:19:15','2017-08-10 12:19:16','2017-08-10 12:19:17','2017-08-10 12:19:18','2017-08-10 12:19:19','2017-08-10 12:19:20','2017-08-10 12:19:21','2017-08-10 12:19:22'),
				'defaultdata' => array(
					array(
						'name' => 'WAF触发量',
						'data' => array(103,20,30,14,30,31,98,82,92,100)
					),
					array(
						'name' => '风控触发量',
						'data' => array(11,22,33,44,55,66,77,88,99,100)
					)
				)
			);
		}elseif ($datastatus == 'dynamic') {
			return array(
				'status' => 1,
				'data' => array(
					'timedic' => date("Y-m-d H:i:s",intval(time())),
					'dydata' => array(
						array(
							'name' => 'WAF触发量',
							'data' => rand(30,100)
						),
						array(
							'name' => '风控触发量',
							'data' => rand(40,110)
						)
					)
				)
			);
		}
	}

	function wafcharts($datastatus)
	{
		if ($datastatus == 'static'){
			return array(
				'status' => 1,
				'legenddata' => array('严重','高危','中危','低危'),
				'timedata' => array('2017-08-10 12:19:13','2017-08-10 12:19:14','2017-08-10 12:19:15','2017-08-10 12:19:16','2017-08-10 12:19:17','2017-08-10 12:19:18','2017-08-10 12:19:19','2017-08-10 12:19:20','2017-08-10 12:19:21','2017-08-10 12:19:22'),
				'defaultdata' => array(
					array(
						'name' => '严重',
						'data' => array(103,40,10,34,10,34,48,81,93,40)
					),
					array(
						'name' => '高危',
						'data' => array(11,22,33,44,55,66,77,88,99,100)
					),
					array(
						'name' => '中危',
						'data' => array(44,51,21,36,74,37,73,31,38,31)
					),
					array(
						'name' => '低危',
						'data' => array(29,56,74,5,73,48,45,22,1,12)
					)
				)
			);
		}elseif ($datastatus == 'dynamic') {
			return array(
				'status' => 1,
				'data' => array(
					'timedic' => date("Y-m-d H:i:s",intval(time())),
					'dydata' => array(
						array(
							'name' => '严重',
							'data' => rand(30,100)
						),
						array(
							'name' => '高危',
							'data' => rand(40,110)
						),
						array(
							'name' => '中危',
							'data' => rand(40,110)
						),
						array(
							'name' => '低危',
							'data' => rand(40,110)
						)
					)
				)
			);
		}
	}

	function windcharts($datastatus)
	{
		if ($datastatus == 'static'){
			return array(
				'status' => 1,
				'legenddata' => array('撞库策略','交易策略','登陆策略','注册策略','简历下载策略','简历导出策略'),
				'timedata' => array('2017-08-10 12:19:13','2017-08-10 12:19:14','2017-08-10 12:19:15','2017-08-10 12:19:16','2017-08-10 12:19:17','2017-08-10 12:19:18','2017-08-10 12:19:19','2017-08-10 12:19:20','2017-08-10 12:19:21','2017-08-10 12:19:22'),
				'defaultdata' => array(
					array(
						'name' => '撞库策略',
						'data' => array(1033,433,100,340,1333,342,483,811,933,402)
					),
					array(
						'name' => '交易策略',
						'data' => array(1133,221,331,441,530,660,771,883,990,1003)
					),
					array(
						'name' => '登陆策略',
						'data' => array(2122,5223,2333,1363,7444,2221,2334,5112,3291,3129)
					),
					array(
						'name' => '注册策略',
						'data' => array(2900,5300,7310,5331,7333,4831,4312,2333,3312,1231)
					),
					array(
						'name' => '简历下载策略',
						'data' => array(1900,1300,2210,3331,4333,1831,2312,3333,5312,6231)
					),
					array(
						'name' => '简历导出策略',
						'data' => array(3900,4300,1210,5331,4536,3831,4312,5333,2312,3231)
					)
				)
			);
		}elseif ($datastatus == 'dynamic') {
			return array(
				'status' => 1,
				'data' => array(
					'timedic' => date("Y-m-d H:i:s",intval(time())),
					'dydata' => array(
						array(
							'name' => '撞库策略',
							'data' => rand(30,100)
						),
						array(
							'name' => '交易策略',
							'data' => rand(400,1102)
						),
						array(
							'name' => '登陆策略',
							'data' => rand(500,1144)
						),
						array(
							'name' => '注册策略',
							'data' => rand(302,1130)
						),
						array(
							'name' => '简历下载策略',
							'data' => rand(1403,1500)
						),
						array(
							'name' => '简历导出策略',
							'data' => rand(1405,1790)
						)
					)
				)
			);
		}
	}

	/**
	 * Dashboard全局数据统计
	 * @return [type] [description]
	 */
	function allcenter_count()
	{
		return array(
			'status' => 1,
			'data' => array(
				array(
					'name' => 'bsp_all',
					'count' => 4303
				),
				array(
					'name' => 'risk_all',
					'count' => 3012
				),
				array(
					'name' => 'waf_all',
					'count' => 2324
				),
				array(
					'name' => 'avail_all',
					'count' => 132
				),
				array(
					'name' => 'eyi_ip_all',
					'count' => 3281
				),
				array(
					'name' => 'safy_zs_all',
					'count' => 76
				)
			)
		);
	}

	/**
	 * Dashboard waf全局统计
	 * @return [type] [description]
	 */
	function wafcharts_count()
	{
		return array(
			'status' => 1,
			'data' => array(
				array(
					'name' => 'serious_vul_all',
					'count' => 4303
				),
				array(
					'name' => 'high_vul_all',
					'count' => 3012
				),
				array(
					'name' => 'medium_vul_all',
					'count' => 2324
				),
				array(
					'name' => 'low_vul_all',
					'count' => 132
				),
				array(
					'name' => 'tools_attack_all',
					'count' => 31112
				),
				array(
					'name' => 'exponent_all',
					'count' => 76
				)
			)
		);
	}

	/**
	 * Dashboard 风控数据统计
	 * @return [type] [description]
	 */
	function windcharts_count()
	{
		return array(
			'status' => 1,
			'data' => array(
				array(
					'name' => 'zero_rules_all',
					'count' => 2321
				),
				array(
					'name' => 'chief_rules_all',
					'count' => 3012
				),
				array(
					'name' => 'common_features_all',
					'count' => 232114
				),
				array(
					'name' => 'accurate_capture_all',
					'count' => 301113
				),
				array(
					'name' => 'monitor_func_all',
					'count' => 1021
				),
				array(
					'name' => 'business_expon_all',
					'count' => 30
				)
			)
		);
	}
}

?>